<!-- HTML header for doxygen 1.8.8-->
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
    <head>
        <meta http-equiv="X-UA-Compatible" content="IE=edge">
        <!-- For Mobile Devices -->
        <meta name="viewport" content="width=device-width, initial-scale=1">
        <meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
        <meta name="generator" content="Doxygen 1.8.18"/>
        <script type="text/javascript" src="https://code.jquery.com/jquery-2.1.1.min.js"></script>
        <title>HElib: /HElib/include/helib/binio.h Source File</title>
        <!--<link href="tabs.css" rel="stylesheet" type="text/css"/>-->
        <script type="text/javascript" src="dynsections.js"></script>
        <link href="search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="search/searchdata.js"></script>
<script type="text/javascript" src="search/search.js"></script>
        <link href="doxygen.css" rel="stylesheet" type="text/css" />
        <link href="customdoxygen.css" rel="stylesheet" type="text/css"/>
        <link href='https://fonts.googleapis.com/css?family=Roboto+Slab' rel='stylesheet' type='text/css'>
		<link href="https://fonts.googleapis.com/css2?family=IBM+Plex+Sans:ital,wght@0,100;1,700&family=Merriweather&family=Merriweather+Sans&family=Open+Sans&family=Poppins:ital@1&family=Roboto:ital,wght@0,400;1,300;1,900&display=swap" rel="stylesheet"> 
        <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css">
        <script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/js/bootstrap.min.js"></script>
        <link href="jquery.smartmenus.bootstrap.css" rel="stylesheet">
        <script type="text/javascript" src="jquery.smartmenus.js"></script>
        <!-- SmartMenus jQuery Bootstrap Addon -->
        <script type="text/javascript" src="jquery.smartmenus.bootstrap.js"></script>
        <!-- SmartMenus jQuery plugin -->
    </head>
    <body style="font-family: 'Merriweather', serif;">
        <nav class="navbar navbar-default" role="navigation">
            <div class="container">
                <div class="navbar-header">
                    <a class="navbar-brand">HElib Implementing Homomorphic Encryption</a>
                </div>
            </div>
        </nav>
        <div id="top"><!-- do not remove this div, it is closed by doxygen! -->
            <div class="content" id="content">
                <div class="container">
                    <div class="row">
                        <div class="col-sm-12 panel " style="padding-bottom: 15px;">
                            <div style="margin-bottom: 15px;">
<!-- end header part -->
<!-- Generated by Doxygen 1.8.18 -->
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&amp;dn=gpl-2.0.txt GPL-v2 */
var searchBox = new SearchBox("searchBox", "search",false,'Search');
/* @license-end */
</script>
<script type="text/javascript" src="menudata.js"></script>
<script type="text/javascript" src="menu.js"></script>
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&amp;dn=gpl-2.0.txt GPL-v2 */
$(function() {
  initMenu('',true,false,'search.php','Search');
  $(document).ready(function() { init_search(); });
});
/* @license-end */</script>
<div id="main-nav"></div>
<!-- window showing the filter options -->
<div id="MSearchSelectWindow"
     onmouseover="return searchBox.OnSearchSelectShow()"
     onmouseout="return searchBox.OnSearchSelectHide()"
     onkeydown="return searchBox.OnSearchSelectKey(event)">
</div>

<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<iframe src="javascript:void(0)" frameborder="0" 
        name="MSearchResults" id="MSearchResults">
</iframe>
</div>

<div id="nav-path" class="navpath">
  <ul>
<li class="navelem"><a class="el" href="dir_d44c64559bbebec7f509842c48db8b23.html">include</a></li><li class="navelem"><a class="el" href="dir_d0c4ae63660968bf6b1c77a1e8aecf95.html">helib</a></li>  </ul>
</div>
</div><!-- top -->
<div class="header">
  <div class="headertitle">
<div class="title">binio.h</div>  </div>
</div><!--header-->
<div class="contents">
<a href="binio_8h.html">Go to the documentation of this file.</a><div class="fragment"><div class="line"><a name="l00001"></a><span class="lineno">    1</span>&#160;<span class="comment">/* Copyright (C) 2012-2020 IBM Corp.</span></div>
<div class="line"><a name="l00002"></a><span class="lineno">    2</span>&#160;<span class="comment"> * This program is Licensed under the Apache License, Version 2.0</span></div>
<div class="line"><a name="l00003"></a><span class="lineno">    3</span>&#160;<span class="comment"> * (the &quot;License&quot;); you may not use this file except in compliance</span></div>
<div class="line"><a name="l00004"></a><span class="lineno">    4</span>&#160;<span class="comment"> * with the License. You may obtain a copy of the License at</span></div>
<div class="line"><a name="l00005"></a><span class="lineno">    5</span>&#160;<span class="comment"> *   http://www.apache.org/licenses/LICENSE-2.0</span></div>
<div class="line"><a name="l00006"></a><span class="lineno">    6</span>&#160;<span class="comment"> * Unless required by applicable law or agreed to in writing, software</span></div>
<div class="line"><a name="l00007"></a><span class="lineno">    7</span>&#160;<span class="comment"> * distributed under the License is distributed on an &quot;AS IS&quot; BASIS,</span></div>
<div class="line"><a name="l00008"></a><span class="lineno">    8</span>&#160;<span class="comment"> * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.</span></div>
<div class="line"><a name="l00009"></a><span class="lineno">    9</span>&#160;<span class="comment"> * See the License for the specific language governing permissions and</span></div>
<div class="line"><a name="l00010"></a><span class="lineno">   10</span>&#160;<span class="comment"> * limitations under the License. See accompanying LICENSE file.</span></div>
<div class="line"><a name="l00011"></a><span class="lineno">   11</span>&#160;<span class="comment"> */</span></div>
<div class="line"><a name="l00012"></a><span class="lineno">   12</span>&#160;<span class="preprocessor">#ifndef HELIB_BINIO_H</span></div>
<div class="line"><a name="l00013"></a><span class="lineno">   13</span>&#160;<span class="preprocessor">#define HELIB_BINIO_H</span></div>
<div class="line"><a name="l00014"></a><span class="lineno">   14</span>&#160;<span class="preprocessor">#include &lt;iostream&gt;</span></div>
<div class="line"><a name="l00015"></a><span class="lineno">   15</span>&#160;<span class="preprocessor">#include &lt;vector&gt;</span></div>
<div class="line"><a name="l00016"></a><span class="lineno">   16</span>&#160;<span class="preprocessor">#include &lt;type_traits&gt;</span></div>
<div class="line"><a name="l00017"></a><span class="lineno">   17</span>&#160;<span class="preprocessor">#include &lt;NTL/xdouble.h&gt;</span></div>
<div class="line"><a name="l00018"></a><span class="lineno">   18</span>&#160;<span class="preprocessor">#include &lt;NTL/vec_long.h&gt;</span></div>
<div class="line"><a name="l00019"></a><span class="lineno">   19</span>&#160; </div>
<div class="line"><a name="l00020"></a><span class="lineno">   20</span>&#160;<span class="preprocessor">#define BINIO_32BIT 4</span></div>
<div class="line"><a name="l00021"></a><span class="lineno"><a class="line" href="binio_8h.html#a4ee5cb19ea20c8eb0a7ec7d26002f41d">   21</a></span>&#160;<span class="preprocessor">#define BINIO_48BIT 6</span></div>
<div class="line"><a name="l00022"></a><span class="lineno"><a class="line" href="binio_8h.html#aca7cf17616cde78f9b10b14bc58f3ee5">   22</a></span>&#160;<span class="preprocessor">#define BINIO_64BIT 8</span></div>
<div class="line"><a name="l00023"></a><span class="lineno"><a class="line" href="binio_8h.html#a6710fa0f385187d61822a5459506918d">   23</a></span>&#160; </div>
<div class="line"><a name="l00024"></a><span class="lineno">   24</span>&#160;<span class="preprocessor">#define BINIO_EYE_SIZE 4</span></div>
<div class="line"><a name="l00025"></a><span class="lineno"><a class="line" href="binio_8h.html#a6223f8038a9df76d72aa42fb9b4e706a">   25</a></span>&#160; </div>
<div class="line"><a name="l00026"></a><span class="lineno">   26</span>&#160;<span class="comment">// clang-format off</span></div>
<div class="line"><a name="l00027"></a><span class="lineno">   27</span>&#160;<span class="preprocessor">#define BINIO_EYE_CONTEXTBASE_BEGIN &quot;|BS[&quot;</span></div>
<div class="line"><a name="l00028"></a><span class="lineno"><a class="line" href="binio_8h.html#ad66827f095034871c8a20ebc3b7de64b">   28</a></span>&#160;<span class="preprocessor">#define BINIO_EYE_CONTEXTBASE_END   &quot;]BS|&quot;</span></div>
<div class="line"><a name="l00029"></a><span class="lineno"><a class="line" href="binio_8h.html#a832df3361429d8069761e90b67997650">   29</a></span>&#160;<span class="preprocessor">#define BINIO_EYE_CONTEXT_BEGIN     &quot;|CN[&quot;</span></div>
<div class="line"><a name="l00030"></a><span class="lineno"><a class="line" href="binio_8h.html#a3b5457d55a432c422338da0e49ca6037">   30</a></span>&#160;<span class="preprocessor">#define BINIO_EYE_CONTEXT_END       &quot;]CN|&quot;</span></div>
<div class="line"><a name="l00031"></a><span class="lineno"><a class="line" href="binio_8h.html#a27058051694a8dcd9b7f94bd77df8391">   31</a></span>&#160;<span class="preprocessor">#define BINIO_EYE_CTXT_BEGIN        &quot;|CX[&quot;</span></div>
<div class="line"><a name="l00032"></a><span class="lineno"><a class="line" href="binio_8h.html#aa0296ce0f3ad67b2958aab5467d6619b">   32</a></span>&#160;<span class="preprocessor">#define BINIO_EYE_CTXT_END          &quot;]CX|&quot;</span></div>
<div class="line"><a name="l00033"></a><span class="lineno"><a class="line" href="binio_8h.html#a79d8a44ab224340a26a4cf94e320afd6">   33</a></span>&#160;<span class="preprocessor">#define BINIO_EYE_PK_BEGIN          &quot;|PK[&quot;</span></div>
<div class="line"><a name="l00034"></a><span class="lineno"><a class="line" href="binio_8h.html#a13a5994c6d0de98db5e6244f90c7b46c">   34</a></span>&#160;<span class="preprocessor">#define BINIO_EYE_PK_END            &quot;]PK|&quot;</span></div>
<div class="line"><a name="l00035"></a><span class="lineno"><a class="line" href="binio_8h.html#a7289fc9d9e108dda51eb9e29c38b4fd1">   35</a></span>&#160;<span class="preprocessor">#define BINIO_EYE_SK_BEGIN          &quot;|SK[&quot;</span></div>
<div class="line"><a name="l00036"></a><span class="lineno"><a class="line" href="binio_8h.html#aa09759cce714124368bffc602a6a7437">   36</a></span>&#160;<span class="preprocessor">#define BINIO_EYE_SK_END            &quot;]SK|&quot;</span></div>
<div class="line"><a name="l00037"></a><span class="lineno"><a class="line" href="binio_8h.html#a3ab2d74f166faecf8d34a044e41654ce">   37</a></span>&#160;<span class="preprocessor">#define BINIO_EYE_SKM_BEGIN         &quot;|KM[&quot;</span></div>
<div class="line"><a name="l00038"></a><span class="lineno"><a class="line" href="binio_8h.html#a934025c2b355ba19eb2f15cbccd2a5fd">   38</a></span>&#160;<span class="preprocessor">#define BINIO_EYE_SKM_END           &quot;]KM|&quot;</span></div>
<div class="line"><a name="l00039"></a><span class="lineno"><a class="line" href="binio_8h.html#a2d30fedb116ebfd370d948b844b98cbf">   39</a></span>&#160;<span class="comment">// clang-format on</span></div>
<div class="line"><a name="l00040"></a><span class="lineno">   40</span>&#160; </div>
<div class="line"><a name="l00041"></a><span class="lineno">   41</span>&#160;<span class="keyword">namespace </span><a class="code" href="namespacehelib.html">helib</a> {</div>
<div class="line"><a name="l00042"></a><span class="lineno">   42</span>&#160; </div>
<div class="line"><a name="l00043"></a><span class="lineno">   43</span>&#160;<span class="comment">/* This struct (or similar) is a nice to have not used at the moment. */</span></div>
<div class="line"><a name="l00044"></a><span class="lineno">   44</span>&#160;<span class="comment">// struct BinaryHeader {</span></div>
<div class="line"><a name="l00045"></a><span class="lineno">   45</span>&#160;<span class="comment">//  uint8_t structId[4];</span></div>
<div class="line"><a name="l00046"></a><span class="lineno">   46</span>&#160;<span class="comment">//  uint8_t version[4] = {0, 0, 0, 1};</span></div>
<div class="line"><a name="l00047"></a><span class="lineno">   47</span>&#160;<span class="comment">//  uint64_t id;</span></div>
<div class="line"><a name="l00048"></a><span class="lineno">   48</span>&#160;<span class="comment">//  uint64_t payloadSize;</span></div>
<div class="line"><a name="l00049"></a><span class="lineno">   49</span>&#160;<span class="comment">//};</span></div>
<div class="line"><a name="l00050"></a><span class="lineno">   50</span>&#160; </div>
<div class="line"><a name="l00051"></a><span class="lineno">   51</span>&#160;<span class="comment">/* Some utility functions for binary IO */</span></div>
<div class="line"><a name="l00052"></a><span class="lineno">   52</span>&#160; </div>
<div class="line"><a name="l00053"></a><span class="lineno">   53</span>&#160;<span class="keywordtype">int</span> <a class="code" href="namespacehelib.html#a3e0de63e6a004056417fc6532985ce6f">readEyeCatcher</a>(std::istream&amp; str, <span class="keyword">const</span> <span class="keywordtype">char</span>* expect);</div>
<div class="line"><a name="l00054"></a><span class="lineno">   54</span>&#160;<span class="keywordtype">void</span> <a class="code" href="namespacehelib.html#a5d1ce128c2df30ef155f565c6435bccb">writeEyeCatcher</a>(std::ostream&amp; str, <span class="keyword">const</span> <span class="keywordtype">char</span>* eye);</div>
<div class="line"><a name="l00055"></a><span class="lineno">   55</span>&#160; </div>
<div class="line"><a name="l00056"></a><span class="lineno">   56</span>&#160;<span class="keywordtype">void</span> <a class="code" href="namespacehelib.html#a3e05ac58f674ea9b53de6804949dea21">write_ntl_vec_long</a>(std::ostream&amp; str,</div>
<div class="line"><a name="l00057"></a><span class="lineno">   57</span>&#160;                        <span class="keyword">const</span> NTL::vec_long&amp; vl,</div>
<div class="line"><a name="l00058"></a><span class="lineno">   58</span>&#160;                        <span class="keywordtype">long</span> intSize = <a class="code" href="binio_8h.html#a6710fa0f385187d61822a5459506918d">BINIO_64BIT</a>);</div>
<div class="line"><a name="l00059"></a><span class="lineno">   59</span>&#160;<span class="keywordtype">void</span> <a class="code" href="namespacehelib.html#af5ff4e18ef29f688fc071601becaafef">read_ntl_vec_long</a>(std::istream&amp; str, NTL::vec_long&amp; vl);</div>
<div class="line"><a name="l00060"></a><span class="lineno">   60</span>&#160; </div>
<div class="line"><a name="l00061"></a><span class="lineno">   61</span>&#160;<span class="keywordtype">long</span> <a class="code" href="namespacehelib.html#ab66308212a98df1821b9bf48c5713bd2">read_raw_int</a>(std::istream&amp; str);</div>
<div class="line"><a name="l00062"></a><span class="lineno">   62</span>&#160;<span class="keywordtype">int</span> <a class="code" href="namespacehelib.html#a529e6135abd723e5eeb63a156224e39a">read_raw_int32</a>(std::istream&amp; str);</div>
<div class="line"><a name="l00063"></a><span class="lineno">   63</span>&#160;<span class="keywordtype">void</span> <a class="code" href="namespacehelib.html#aab7bbf963ee93061e4bb1204438721b1">write_raw_int</a>(std::ostream&amp; str, <span class="keywordtype">long</span> num);</div>
<div class="line"><a name="l00064"></a><span class="lineno">   64</span>&#160;<span class="keywordtype">void</span> <a class="code" href="namespacehelib.html#a86af3712f18a5b1fca62330b37dbb9de">write_raw_int32</a>(std::ostream&amp; str, <span class="keywordtype">int</span> num);</div>
<div class="line"><a name="l00065"></a><span class="lineno">   65</span>&#160; </div>
<div class="line"><a name="l00066"></a><span class="lineno">   66</span>&#160;<span class="keywordtype">void</span> <a class="code" href="namespacehelib.html#aafadc64ab3b1c319e37160cd619f3bf5">write_raw_double</a>(std::ostream&amp; str, <span class="keyword">const</span> <span class="keywordtype">double</span> d);</div>
<div class="line"><a name="l00067"></a><span class="lineno">   67</span>&#160;<span class="keywordtype">double</span> <a class="code" href="namespacehelib.html#aa1c396577dc7ac07293effb9e8e20364">read_raw_double</a>(std::istream&amp; str);</div>
<div class="line"><a name="l00068"></a><span class="lineno">   68</span>&#160; </div>
<div class="line"><a name="l00069"></a><span class="lineno">   69</span>&#160;<span class="keywordtype">void</span> <a class="code" href="namespacehelib.html#aedb770c4cb5c37da9184d5820a000758">write_raw_xdouble</a>(std::ostream&amp; str, <span class="keyword">const</span> NTL::xdouble xd);</div>
<div class="line"><a name="l00070"></a><span class="lineno">   70</span>&#160;NTL::xdouble <a class="code" href="namespacehelib.html#aad981561d84bb94d22a6c5c3e1619806">read_raw_xdouble</a>(std::istream&amp; str);</div>
<div class="line"><a name="l00071"></a><span class="lineno">   71</span>&#160; </div>
<div class="line"><a name="l00072"></a><span class="lineno">   72</span>&#160;<span class="keywordtype">void</span> <a class="code" href="namespacehelib.html#a7f1521af0f4ab251d30fc4f96531dc1d">write_raw_ZZ</a>(std::ostream&amp; str, <span class="keyword">const</span> NTL::ZZ&amp; zz);</div>
<div class="line"><a name="l00073"></a><span class="lineno">   73</span>&#160;<span class="keywordtype">void</span> <a class="code" href="namespacehelib.html#adfd83ed995cf19419ab46fa84b2711a7">read_raw_ZZ</a>(std::istream&amp; str, NTL::ZZ&amp; zz);</div>
<div class="line"><a name="l00074"></a><span class="lineno">   74</span>&#160; </div>
<div class="line"><a name="l00075"></a><span class="lineno">   75</span>&#160;<span class="keyword">template</span> &lt;<span class="keyword">typename</span> T&gt;</div>
<div class="line"><a name="l00076"></a><span class="lineno"><a class="line" href="namespacehelib.html#aaeff8e262314e10ad618189976b9ef93">   76</a></span>&#160;<span class="keywordtype">void</span> <a class="code" href="namespacehelib.html#aaeff8e262314e10ad618189976b9ef93">write_raw_vector</a>(std::ostream&amp; str, <span class="keyword">const</span> std::vector&lt;T&gt;&amp; v)</div>
<div class="line"><a name="l00077"></a><span class="lineno">   77</span>&#160;{</div>
<div class="line"><a name="l00078"></a><span class="lineno">   78</span>&#160;  <a class="code" href="namespacehelib.html#aab7bbf963ee93061e4bb1204438721b1">write_raw_int</a>(str, v.size());</div>
<div class="line"><a name="l00079"></a><span class="lineno">   79</span>&#160; </div>
<div class="line"><a name="l00080"></a><span class="lineno">   80</span>&#160;  <span class="keywordflow">for</span> (<span class="keyword">const</span> T&amp; n : v) {</div>
<div class="line"><a name="l00081"></a><span class="lineno">   81</span>&#160;    n.write(str);</div>
<div class="line"><a name="l00082"></a><span class="lineno">   82</span>&#160;  }</div>
<div class="line"><a name="l00083"></a><span class="lineno">   83</span>&#160;}</div>
<div class="line"><a name="l00084"></a><span class="lineno">   84</span>&#160; </div>
<div class="line"><a name="l00085"></a><span class="lineno">   85</span>&#160;<span class="comment">// vector&lt;long&gt; has a different implementation, since long.write does not work</span></div>
<div class="line"><a name="l00086"></a><span class="lineno">   86</span>&#160;<span class="keyword">template</span> &lt;&gt;</div>
<div class="line"><a name="l00087"></a><span class="lineno">   87</span>&#160;<span class="keywordtype">void</span> <a class="code" href="namespacehelib.html#a718430742226b3f7c2b81073ea10cc64">write_raw_vector&lt;long&gt;</a>(std::ostream&amp; str, <span class="keyword">const</span> std::vector&lt;long&gt;&amp; v);</div>
<div class="line"><a name="l00088"></a><span class="lineno">   88</span>&#160; </div>
<div class="line"><a name="l00089"></a><span class="lineno">   89</span>&#160;<span class="comment">// vector&lt;double&gt; has a different implementation, since double.write does not</span></div>
<div class="line"><a name="l00090"></a><span class="lineno">   90</span>&#160;<span class="comment">// work</span></div>
<div class="line"><a name="l00091"></a><span class="lineno">   91</span>&#160;<span class="keyword">template</span> &lt;&gt;</div>
<div class="line"><a name="l00092"></a><span class="lineno">   92</span>&#160;<span class="keywordtype">void</span> <a class="code" href="namespacehelib.html#a374f958d521a444ec5686722c2dfad8b">write_raw_vector&lt;double&gt;</a>(std::ostream&amp; str, <span class="keyword">const</span> std::vector&lt;double&gt;&amp; v);</div>
<div class="line"><a name="l00093"></a><span class="lineno">   93</span>&#160; </div>
<div class="line"><a name="l00094"></a><span class="lineno">   94</span>&#160;<span class="keyword">template</span> &lt;<span class="keyword">typename</span> T&gt;</div>
<div class="line"><a name="l00095"></a><span class="lineno"><a class="line" href="namespacehelib.html#a9e907022dc0cd7bdf40f457b786ab924">   95</a></span>&#160;<span class="keywordtype">void</span> <a class="code" href="namespacehelib.html#a9e907022dc0cd7bdf40f457b786ab924">read_raw_vector</a>(std::istream&amp; str, std::vector&lt;T&gt;&amp; v, T&amp; init)</div>
<div class="line"><a name="l00096"></a><span class="lineno">   96</span>&#160;{</div>
<div class="line"><a name="l00097"></a><span class="lineno">   97</span>&#160;  <span class="keywordtype">long</span> sz = <a class="code" href="namespacehelib.html#ab66308212a98df1821b9bf48c5713bd2">read_raw_int</a>(str);</div>
<div class="line"><a name="l00098"></a><span class="lineno">   98</span>&#160;  v.resize(sz, init); <span class="comment">// Make space in vector</span></div>
<div class="line"><a name="l00099"></a><span class="lineno">   99</span>&#160; </div>
<div class="line"><a name="l00100"></a><span class="lineno">  100</span>&#160;  <span class="keywordflow">for</span> (<span class="keyword">auto</span>&amp; n : v) {</div>
<div class="line"><a name="l00101"></a><span class="lineno">  101</span>&#160;    n.read(str);</div>
<div class="line"><a name="l00102"></a><span class="lineno">  102</span>&#160;  }</div>
<div class="line"><a name="l00103"></a><span class="lineno">  103</span>&#160;}</div>
<div class="line"><a name="l00104"></a><span class="lineno">  104</span>&#160; </div>
<div class="line"><a name="l00105"></a><span class="lineno">  105</span>&#160;<span class="keyword">template</span> &lt;<span class="keyword">typename</span> T&gt;</div>
<div class="line"><a name="l00106"></a><span class="lineno"><a class="line" href="namespacehelib.html#aaa0e61f1c81f568bd942e3f50b4c5301">  106</a></span>&#160;<span class="keywordtype">void</span> <a class="code" href="namespacehelib.html#a9e907022dc0cd7bdf40f457b786ab924">read_raw_vector</a>(std::istream&amp; str, std::vector&lt;T&gt;&amp; v)</div>
<div class="line"><a name="l00107"></a><span class="lineno">  107</span>&#160;{</div>
<div class="line"><a name="l00108"></a><span class="lineno">  108</span>&#160;  read_raw_vector&lt;T&gt;(str, v, T());</div>
<div class="line"><a name="l00109"></a><span class="lineno">  109</span>&#160;}</div>
<div class="line"><a name="l00110"></a><span class="lineno">  110</span>&#160; </div>
<div class="line"><a name="l00111"></a><span class="lineno">  111</span>&#160;<span class="comment">// vector&lt;long&gt; has a different implementation, since long.read does not work</span></div>
<div class="line"><a name="l00112"></a><span class="lineno">  112</span>&#160;<span class="keyword">template</span> &lt;&gt;</div>
<div class="line"><a name="l00113"></a><span class="lineno">  113</span>&#160;<span class="keywordtype">void</span> <a class="code" href="namespacehelib.html#a6f201a18aa3be048c7935a97c1bd4e82">read_raw_vector&lt;long&gt;</a>(std::istream&amp; str, std::vector&lt;long&gt;&amp; v);</div>
<div class="line"><a name="l00114"></a><span class="lineno">  114</span>&#160; </div>
<div class="line"><a name="l00115"></a><span class="lineno">  115</span>&#160;<span class="comment">// vector&lt;double&gt; has a different implementation, since double.read does not</span></div>
<div class="line"><a name="l00116"></a><span class="lineno">  116</span>&#160;<span class="comment">// work</span></div>
<div class="line"><a name="l00117"></a><span class="lineno">  117</span>&#160;<span class="keyword">template</span> &lt;&gt;</div>
<div class="line"><a name="l00118"></a><span class="lineno">  118</span>&#160;<span class="keywordtype">void</span> <a class="code" href="namespacehelib.html#a591c5643829af4b3738d1e6cc807518e">read_raw_vector&lt;double&gt;</a>(std::istream&amp; str, std::vector&lt;double&gt;&amp; v);</div>
<div class="line"><a name="l00119"></a><span class="lineno">  119</span>&#160; </div>
<div class="line"><a name="l00120"></a><span class="lineno">  120</span>&#160;<span class="comment">// KeySwitch::read(...) (in keySwitching.cpp) requires the context.</span></div>
<div class="line"><a name="l00121"></a><span class="lineno">  121</span>&#160;<span class="keyword">class </span>Context;</div>
<div class="line"><a name="l00122"></a><span class="lineno">  122</span>&#160;<span class="keyword">template</span> &lt;<span class="keyword">typename</span> T&gt;</div>
<div class="line"><a name="l00123"></a><span class="lineno"><a class="line" href="namespacehelib.html#a03a42dc495a369c587d7bfe577a1fc29">  123</a></span>&#160;<span class="keywordtype">void</span> <a class="code" href="namespacehelib.html#a9e907022dc0cd7bdf40f457b786ab924">read_raw_vector</a>(std::istream&amp; str,</div>
<div class="line"><a name="l00124"></a><span class="lineno">  124</span>&#160;                     std::vector&lt;T&gt;&amp; v,</div>
<div class="line"><a name="l00125"></a><span class="lineno">  125</span>&#160;                     <span class="keyword">const</span> <a class="code" href="classhelib_1_1_context.html">Context</a>&amp; context)</div>
<div class="line"><a name="l00126"></a><span class="lineno">  126</span>&#160;{</div>
<div class="line"><a name="l00127"></a><span class="lineno">  127</span>&#160;  <span class="keywordtype">long</span> sz = <a class="code" href="namespacehelib.html#ab66308212a98df1821b9bf48c5713bd2">read_raw_int</a>(str);</div>
<div class="line"><a name="l00128"></a><span class="lineno">  128</span>&#160;  v.resize(sz); <span class="comment">// Make space in vector</span></div>
<div class="line"><a name="l00129"></a><span class="lineno">  129</span>&#160; </div>
<div class="line"><a name="l00130"></a><span class="lineno">  130</span>&#160;  <span class="keywordflow">for</span> (<span class="keyword">auto</span>&amp; n : v) {</div>
<div class="line"><a name="l00131"></a><span class="lineno">  131</span>&#160;    n.read(str, context);</div>
<div class="line"><a name="l00132"></a><span class="lineno">  132</span>&#160;  }</div>
<div class="line"><a name="l00133"></a><span class="lineno">  133</span>&#160;}</div>
<div class="line"><a name="l00134"></a><span class="lineno">  134</span>&#160; </div>
<div class="line"><a name="l00135"></a><span class="lineno">  135</span>&#160;} <span class="comment">// namespace helib</span></div>
<div class="line"><a name="l00136"></a><span class="lineno">  136</span>&#160;<span class="preprocessor">#endif // ifndef HELIB_BINIO_H</span></div>
</div><!-- fragment --></div><!-- contents -->
<div class="ttc" id="anamespacehelib_html_a3e0de63e6a004056417fc6532985ce6f"><div class="ttname"><a href="namespacehelib.html#a3e0de63e6a004056417fc6532985ce6f">helib::readEyeCatcher</a></div><div class="ttdeci">int readEyeCatcher(std::istream &amp;str, const char *expect)</div><div class="ttdef"><b>Definition:</b> binio.cpp:21</div></div>
<div class="ttc" id="anamespacehelib_html_a5d1ce128c2df30ef155f565c6435bccb"><div class="ttname"><a href="namespacehelib.html#a5d1ce128c2df30ef155f565c6435bccb">helib::writeEyeCatcher</a></div><div class="ttdeci">void writeEyeCatcher(std::ostream &amp;str, const char *eye)</div><div class="ttdef"><b>Definition:</b> binio.cpp:28</div></div>
<div class="ttc" id="anamespacehelib_html_aafadc64ab3b1c319e37160cd619f3bf5"><div class="ttname"><a href="namespacehelib.html#aafadc64ab3b1c319e37160cd619f3bf5">helib::write_raw_double</a></div><div class="ttdeci">void write_raw_double(std::ostream &amp;str, const double d)</div><div class="ttdef"><b>Definition:</b> binio.cpp:148</div></div>
<div class="ttc" id="anamespacehelib_html_a9e907022dc0cd7bdf40f457b786ab924"><div class="ttname"><a href="namespacehelib.html#a9e907022dc0cd7bdf40f457b786ab924">helib::read_raw_vector</a></div><div class="ttdeci">void read_raw_vector(std::istream &amp;str, std::vector&lt; T &gt; &amp;v, T &amp;init)</div><div class="ttdef"><b>Definition:</b> binio.h:95</div></div>
<div class="ttc" id="anamespacehelib_html_a7f1521af0f4ab251d30fc4f96531dc1d"><div class="ttname"><a href="namespacehelib.html#a7f1521af0f4ab251d30fc4f96531dc1d">helib::write_raw_ZZ</a></div><div class="ttdeci">void write_raw_ZZ(std::ostream &amp;str, const NTL::ZZ &amp;zz)</div><div class="ttdef"><b>Definition:</b> binio.cpp:180</div></div>
<div class="ttc" id="anamespacehelib_html_aaeff8e262314e10ad618189976b9ef93"><div class="ttname"><a href="namespacehelib.html#aaeff8e262314e10ad618189976b9ef93">helib::write_raw_vector</a></div><div class="ttdeci">void write_raw_vector(std::ostream &amp;str, const std::vector&lt; T &gt; &amp;v)</div><div class="ttdef"><b>Definition:</b> binio.h:76</div></div>
<div class="ttc" id="anamespacehelib_html_a3e05ac58f674ea9b53de6804949dea21"><div class="ttname"><a href="namespacehelib.html#a3e05ac58f674ea9b53de6804949dea21">helib::write_ntl_vec_long</a></div><div class="ttdeci">void write_ntl_vec_long(std::ostream &amp;str, const NTL::vec_long &amp;vl, long intSize=BINIO_64BIT)</div><div class="ttdef"><b>Definition:</b> binio.cpp:105</div></div>
<div class="ttc" id="anamespacehelib_html_a529e6135abd723e5eeb63a156224e39a"><div class="ttname"><a href="namespacehelib.html#a529e6135abd723e5eeb63a156224e39a">helib::read_raw_int32</a></div><div class="ttdeci">int read_raw_int32(std::istream &amp;str)</div><div class="ttdef"><b>Definition:</b> binio.cpp:56</div></div>
<div class="ttc" id="anamespacehelib_html_aa1c396577dc7ac07293effb9e8e20364"><div class="ttname"><a href="namespacehelib.html#aa1c396577dc7ac07293effb9e8e20364">helib::read_raw_double</a></div><div class="ttdeci">double read_raw_double(std::istream &amp;str)</div><div class="ttdef"><b>Definition:</b> binio.cpp:157</div></div>
<div class="ttc" id="abinio_8h_html_a6710fa0f385187d61822a5459506918d"><div class="ttname"><a href="binio_8h.html#a6710fa0f385187d61822a5459506918d">BINIO_64BIT</a></div><div class="ttdeci">#define BINIO_64BIT</div><div class="ttdef"><b>Definition:</b> binio.h:22</div></div>
<div class="ttc" id="anamespacehelib_html_a591c5643829af4b3738d1e6cc807518e"><div class="ttname"><a href="namespacehelib.html#a591c5643829af4b3738d1e6cc807518e">helib::read_raw_vector&lt; double &gt;</a></div><div class="ttdeci">void read_raw_vector&lt; double &gt;(std::istream &amp;str, std::vector&lt; double &gt; &amp;v)</div><div class="ttdef"><b>Definition:</b> binio.cpp:231</div></div>
<div class="ttc" id="anamespacehelib_html_a374f958d521a444ec5686722c2dfad8b"><div class="ttname"><a href="namespacehelib.html#a374f958d521a444ec5686722c2dfad8b">helib::write_raw_vector&lt; double &gt;</a></div><div class="ttdeci">void write_raw_vector&lt; double &gt;(std::ostream &amp;str, const std::vector&lt; double &gt; &amp;v)</div><div class="ttdef"><b>Definition:</b> binio.cpp:242</div></div>
<div class="ttc" id="anamespacehelib_html_adfd83ed995cf19419ab46fa84b2711a7"><div class="ttname"><a href="namespacehelib.html#adfd83ed995cf19419ab46fa84b2711a7">helib::read_raw_ZZ</a></div><div class="ttdeci">void read_raw_ZZ(std::istream &amp;str, NTL::ZZ &amp;zz)</div><div class="ttdef"><b>Definition:</b> binio.cpp:193</div></div>
<div class="ttc" id="anamespacehelib_html_af5ff4e18ef29f688fc071601becaafef"><div class="ttname"><a href="namespacehelib.html#af5ff4e18ef29f688fc071601becaafef">helib::read_ntl_vec_long</a></div><div class="ttdeci">void read_ntl_vec_long(std::istream &amp;str, NTL::vec_long &amp;vl)</div><div class="ttdef"><b>Definition:</b> binio.cpp:125</div></div>
<div class="ttc" id="anamespacehelib_html_aad981561d84bb94d22a6c5c3e1619806"><div class="ttname"><a href="namespacehelib.html#aad981561d84bb94d22a6c5c3e1619806">helib::read_raw_xdouble</a></div><div class="ttdeci">NTL::xdouble read_raw_xdouble(std::istream &amp;str)</div><div class="ttdef"><b>Definition:</b> binio.cpp:173</div></div>
<div class="ttc" id="anamespacehelib_html"><div class="ttname"><a href="namespacehelib.html">helib</a></div><div class="ttdef"><b>Definition:</b> apiAttributes.h:21</div></div>
<div class="ttc" id="anamespacehelib_html_ab66308212a98df1821b9bf48c5713bd2"><div class="ttname"><a href="namespacehelib.html#ab66308212a98df1821b9bf48c5713bd2">helib::read_raw_int</a></div><div class="ttdeci">long read_raw_int(std::istream &amp;str)</div><div class="ttdef"><b>Definition:</b> binio.cpp:36</div></div>
<div class="ttc" id="anamespacehelib_html_a6f201a18aa3be048c7935a97c1bd4e82"><div class="ttname"><a href="namespacehelib.html#a6f201a18aa3be048c7935a97c1bd4e82">helib::read_raw_vector&lt; long &gt;</a></div><div class="ttdeci">void read_raw_vector&lt; long &gt;(std::istream &amp;str, std::vector&lt; long &gt; &amp;v)</div><div class="ttdef"><b>Definition:</b> binio.cpp:210</div></div>
<div class="ttc" id="anamespacehelib_html_aab7bbf963ee93061e4bb1204438721b1"><div class="ttname"><a href="namespacehelib.html#aab7bbf963ee93061e4bb1204438721b1">helib::write_raw_int</a></div><div class="ttdeci">void write_raw_int(std::ostream &amp;str, long num)</div><div class="ttdef"><b>Definition:</b> binio.cpp:77</div></div>
<div class="ttc" id="aclasshelib_1_1_context_html"><div class="ttname"><a href="classhelib_1_1_context.html">helib::Context</a></div><div class="ttdoc">Maintaining the parameters.</div><div class="ttdef"><b>Definition:</b> Context.h:58</div></div>
<div class="ttc" id="anamespacehelib_html_a86af3712f18a5b1fca62330b37dbb9de"><div class="ttname"><a href="namespacehelib.html#a86af3712f18a5b1fca62330b37dbb9de">helib::write_raw_int32</a></div><div class="ttdeci">void write_raw_int32(std::ostream &amp;str, int num)</div><div class="ttdef"><b>Definition:</b> binio.cpp:91</div></div>
<div class="ttc" id="anamespacehelib_html_a718430742226b3f7c2b81073ea10cc64"><div class="ttname"><a href="namespacehelib.html#a718430742226b3f7c2b81073ea10cc64">helib::write_raw_vector&lt; long &gt;</a></div><div class="ttdeci">void write_raw_vector&lt; long &gt;(std::ostream &amp;str, const std::vector&lt; long &gt; &amp;v)</div><div class="ttdef"><b>Definition:</b> binio.cpp:221</div></div>
<div class="ttc" id="anamespacehelib_html_aedb770c4cb5c37da9184d5820a000758"><div class="ttname"><a href="namespacehelib.html#aedb770c4cb5c37da9184d5820a000758">helib::write_raw_xdouble</a></div><div class="ttdeci">void write_raw_xdouble(std::ostream &amp;str, const NTL::xdouble xd)</div><div class="ttdef"><b>Definition:</b> binio.cpp:165</div></div>
<!-- HTML footer for doxygen 1.8.8-->
<!-- start footer part -->
</div>
</div>
</div>
</div>
</div>
<hr class="footer"/><address class="footer"><small>
Generated by &#160;<a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/>
</a> 1.8.18
</small></address>
</body>
        <script type="text/javascript" src="doxy-boot.js"></script>
</html>
